<template>
  <div>
    <Phead />
    <Pmsg />
    <div class="personal-content w clearfix">
         <Pmy />


          <!-- 个人中心 > 身份认证 -->
        <div class="right identity">
            <h3 class="stamp">认证中心</h3>
            
            <div class="notpass">
                <img src="@/assets/img/notpass.png" alt="" v-if="user_status == 3">
                <img src="@/assets/img/pass.png" alt="" v-else>
                <p>{{info}}</p>
                <button type="button" @click="toIndex">查看竞价信息</button>
        <button type="button" v-if="rePush" @click="toRegister">重新认证</button>
            </div>
        </div>
    </div>
    
  <Pfoot />
  </div>

</template>
<script>
import Phead from '@/components/Phead.vue'
import Pfoot from '@/components/Pfoot.vue'
import Pmy from '@/components/Pmy.vue'
import Pmsg from '@/components/Pmsg.vue'
    
export default {
  data(){
    return{
          user_status:0,
          info:'',
          rePush:false,
     }
  },
  async created(){
    let info = ''
    let re = await this.$axios.post('user/getUserByToken')
        if(re.code == 200){
              if(re.data.user_status ==0){
                this.$router.push({path:'/register/status'})

              }else if(re.data.user_status ==1){
                info = "等待审核，小麦正在紧急审核中...";

              }else if(re.data.user_status ==2){
                info = "恭喜,审核通过了!";

              }else if(re.data.user_status ==3){
                info = "您的审核被驳回了,请联系客服";
                this.rePush = true

              }
              this.user_status = re.data.user_status;
              this.info = info
          
         }
  },
  
  mounted(){
            
  },

  components: {
    Phead,
    Pfoot,
    Pmy,
    Pmsg
  },
  
  methods:{
   async toRegister(){
          let re = await this.$axios.post('user/getUserByToken')
          if(re.code == 200){
              if(re.data.user_type ==10){
                  this.$router.push({path:'/register/cgregister'})

              }else if(re.data.user_type ==11){
                  this.$router.push({path:'/register/gysregister'})

              }
          
           }

    },
    toIndex(){
      this.$router.push({path:'/'})
    }

  }

}
</script>
